#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int removeElement(int* nums, int numsSize, int val)
{
	int* help = (int*)malloc(sizeof(int) * numsSize);
	int i = 0;
	int j = 0;
	while( i < numsSize)
	{
		if (nums[i] != val)
		{
			help[j++] = nums[i];
		}
		i++;
	}
	for (i = 0; i < j; i++)
	{
		nums[i] = help[i];
	}
	return j;
}
int main()
{
	int arr[] = { 0,1,2,2,3,0,4,2 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int val = 2;
	int ret = removeElement(arr, sz, val);
	printf("%d\n", ret);
	for (int i = 0; i < ret; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}